home *** CD-ROM | disk | FTP | other *** search
- .\"{{{}}}
- .\"{{{ Notes
- .\" nroff -ms intro.ms | more
- .ds Tx T\v'2p'E\v'-2p'X
- .\"}}}
- .\"{{{ Title and Abstract
- .TL
- Introduction to Folding Editors
- .AU
- Michael Haardt
- .AI
- R\(:utscherstra\(sse 155/1703
- 52072 Aachen
- Germany
- (u31b3hs@pool.informatik.rwth-aachen.de)
- .AB
- This document explains the principles of folding editors in general,
- because most people have never used such an editor. It gives an example of
- an Origami editing session to show the advantages of folding program sources.
- .AE
- .\"}}}
- .\"{{{ Introduction
- .NH 1
- Introduction
- .LP
- Origami is a
- .I folding
- .I editor ,
- similar to, and inspired by, the editor included in the Inmos TDS
- (Transputer Development System). Those of us who have become familiar
- with the TDS editor have long bemoaned the lack of a similar editor for
- use with other languages, for example Pascal and C.
- .PP
- Origami is not a word processor (although many of its features would be
- useful in a word processor), but it comes into its own as a program
- editor for structured languages and documents. The structuring of the
- code or text is obvious from the screen display (if Origami is sensibly
- used!), although no actual code may be visible.
- .PP
- Existing files, not produced using Origami, may be imported into
- Origami, and then folded up for future use, and ease of development.
- These files may be further edited either using Origami or some other
- editor (if you can bear to use one after Origami!), and compiled in the
- normal way.
- .PP
- A folding editor extends the principle of tree structured directories
- to editing text files. This allows the simultaneous display of large amounts
- of text by folding sections of text away behind a descriptive
- heading. This results in a tree structure very similar to a
- subdirectory structure of, for example, MINIX.
- .PP
- By suitable structuring of a text it should be possible, in most
- circumstances, to ensure that no display exceeds a single screen at any
- time. To access text which is folded away you can either
- .I enter
- the containing fold, in which case the contents of the fold and its
- header are the only displayed text, or you can
- .I open
- the fold, in which case the contents are displayed in the context of the
- surrounding text.
- .PP
- The advantage of this system is that it eliminates the need for
- seemingly endless paging through long files to find the section of
- interest, allowing you to move down the tree structure, following the
- (hopefully) descriptive headers to locate the text you require.
- .\"}}}
- .\"{{{ Examples of Origami folding
- .NH 1
- Examples of Origami Folding
- .LP
- As an example, a Pascal file might look like this at
- the top level (e.g.\& immediately after starting Origami):
- .DS L
- program test;
- \&... CONSTs
- \&... TYPEs
- \&... VARs
- \&... procedures
- \&... main body of code
- .DE
- OPENing the VARs fold might lead to the following display:
- .DS L
- program test;
- \&... CONSTs
- \&... TYPEs
- {\&{\&{ VARs
- VAR i : integer;
- x : real;
- }\&}\&}
- \&... procedures
- \&... main body of code
- .DE
- ENTERing the procedures fold might give:
- .DS L
- {\&{\&{ procedures
- \&... statistical procedures
- \&... string handling procedures
- \&... procedure user_input
- }\&}\&}
- .DE
- Each of these folds can be
- .I entered
- further until actual code is reached \(em for example if we
- .I enter
- the procedure user_input fold we might find:
- .DS L
- {\&{\&{ procedure user_input
- procedure user_input(prompt : str_type; var reply : str_type);
- \&... local declarations
- \&... local procedures
- begin
- repeat
- write(prompt);
- readln(reply);
- until verify_reply(reply);
- end;
- }\&}\&}
- .DE
- Folds can be nested and indented. It is also possible, to attach a file
- to a fold, which means that you enter a fold in your text, which is
- stored in another file. There are utitilies, which create nested file
- folds of whole directory trees. This means, that you can reach all
- files of a project in Origami without typing filenames.
- .\"}}}
- .\"{{{ foldmarks and the comment language
- .NH 1
- Commenting the fold-structure
- .LP
- The folds are stored in the text as normal text lines. Origami can use
- one of the following languages, to prevent conflicts with compilers:
- ways:
- .\"{{{ NONE
- .IP None 1.5c
- \&{\&{\&{ this is a fold
- .br
- \&{\&{\&{F this is a filed fold
- .br
- \&:\&:\&:F filename.h
- .br
- \&}\&}\&}
- fold-comment and filename are stored in
- two lines, so they can be different!
- .br
- \&}\&}\&}
- .br
- .\"}}}
- .\"{{{ Occam
- .IP Occam 1.5c
- --\&{\&{\&{ this is a fold
- .br
- --\&{\&{\&{F this is a filed fold
- .br
- --\&:\&:\&:F filename.h
- .br
- --\&}\&}\&}
- .br
- --\&}\&}\&}
- .br
- .\"}}}
- .\"{{{ Pascal
- .IP Pascal 1.5c
- (*\&{\&{\&{ this is a fold *)
- .br
- (*\&{\&{\&{F this is a filed fold*)
- .br
- (*\&:\&:\&:F filename.h*)
- .br
- (*\&}\&}\&} *)
- .br
- (*\&}\&}\&} *)
- .br
- .\"}}}
- .\"{{{ C
- .IP C 1.5c
- /*\&{\&{\&{ this is a fold*/
- .br
- /*\&{\&{\&{F this is a filed fold*/
- .br
- /*\&:\&:\&:F filename.h*/
- .br
- /*\&}\&}\&} */
- .br
- /*\&}\&}\&} */
- .br
- .\"}}}
- .\"{{{ Lisp
- .IP Lisp 1.5c
- ;\&{\&{\&{ this is a fold
- .br
- ;\&{\&{\&{F this is a filed fold
- .br
- ;\&:\&:\&:F filename.h
- .br
- ;\&}\&}\&}
- .br
- ;\&}\&}\&}
- .br
- .\"}}}
- .\"{{{ roff
- .IP Roff 1.5c
- \&.\e"\&{\&{\&{ this is a fold
- .br
- \&.\e"\&{\&{\&{F this is a filed fold
- .br
- \&.\e"\&:\&:\&:F filename.h
- .br
- \&.\e"\&}\&}\&}
- .br
- \&.\e"\&}\&}\&}
- .br
- .\"}}}
- .\"{{{ tex
- .IP \*(Tx 1.5c
- %\&{\&{\&{ this is a fold
- .br
- %\&{\&{\&{F this is a filed fold
- .br
- %\&:\&:\&:F filename.h
- .br
- %\&}\&}\&}
- .br
- %\&}\&}\&}
- .br
- .\"}}}
- .\"{{{ script
- .IP Script 1.5c
- #\&{\&{\&{ this is a fold
- .br
- \\&{\&{\&{F this is a filed fold
- .br
- \\&:\&:\&:F filename.h
- .br
- \\&}\&}\&}
- .br
- #\&}\&}\&}
- .br
- .\"}}}
- .\"{{{ user
- .IP User 1.5c
- You can specify the start and end of the comment yourself.
- .br
- @@@\&{\&{\&{ this is a fold$$$
- .br
- @@@\&{\&{\&{F this is a filed fold$$$
- .br
- @@@\&:\&:\&:F filename.h$$$
- .br
- @@@\&}\&}\&} $$$
- .br
- @@@\&}\&}\&} $$$
- .br
- .\"}}}
- .\"{{{ Inmos
- .IP Inmos 1.5c
- This is a binary format. It can be used, to edit TDS/MultiTool files
- without converting them.
- .\"}}}
- .LP
- The marks {\&{\&{, :\&:\&: and }\&}\&} can be replaced by other
- characters via command line option.
- .\"}}}
- .\"{{{ Summary
- .NH 1
- Summary
- .LP
- Experience has shown, that a folding editor supports more modular
- and well commented source code. The code has a better structure,
- because the structure is obvious. Editing gets more efficient, because
- moving to a particular place in the code is very easy.
- .PP
- We also use Origami as an editor for \*(Tx and roff documents.
- Many people discovered a bad structure in their documents, after they
- folded them with Origami.
- .PP
- The universality of the folding concept allows to use Origami as an
- editor for nearly every task. This means, that we even fold rc files
- with it.
- .\"}}}
-